<template>
  <div class="clue-step">
    <div class="step" :style="{ backgroundColor: stepBgc1 }">
      <div class="arrow" :style="{ backgroundColor: arrowBgc1 }"></div>
      <div class="num">1</div>
      <div class="title">线索征集</div>
    </div>
    <div class="step" :style="{ backgroundColor: stepBgc2 }">
      <div class="arrow" :style="{ backgroundColor: arrowBgc2 }"></div>
      <div class="num">2</div>
      <div class="title">鉴定估价</div>
    </div>
    <div class="step" :style="{ backgroundColor: stepBgc3 }">
      <div class="arrow" :style="{ backgroundColor: arrowBgc3 }"></div>
      <div class="num">3</div>
      <div class="title">确认征集</div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    current: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      arrowBgc1: '#3ab64e',
      stepBgc1: '#3ab64e',
      arrowBgc2: '#3ab64e',
      stepBgc2: '#3ab64e',
      arrowBgc3: '#3ab64e',
      stepBgc3: '#3ab64e'
    };
  },
  created() {
    const blue = '#01b8f5';
    const green = '#3ab64e';
    const current = this.current;
    if (current === 1) {
      this.arrowBgc2 = blue;
      this.arrowBgc1 = blue;
      this.stepBgc1 = blue;
    } else if (current === 2) {
      this.arrowBgc3 = blue;
      this.stepBgc2 = blue;
    } else if (current === 3) {
      this.arrowBgc3 = green;
      this.stepBgc3 = blue;
    }
  }
};
</script>

<style lang="scss" scoped>
.clue-step {
  display: flex;
  overflow: hidden;
  margin-bottom: 20px;
  .step {
    font-size: 14px;
    flex: 1;
    height: 36px;
    line-height: 36px;
    background-color: #3ab64e;
    color: white;
    position: relative;
    padding-left: 20px;
    display: flex;
    align-items: center;
    text-align: center;
    justify-content: center;
  }

  .arrow {
    width: 36px;
    height: 36px;
    border-top: 1px solid #eee;
    border-right: 1px solid #eee;
    transform: rotate(45deg);
    position: absolute;
    left: -26px;
    top: 0;
    background-color: #3ab64e;
  }

  .num {
    position: absolute;
    top: 8px;
    left: 24px;
    background-color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    color: #3ab64e;
    text-align: center;
    line-height: 20px;
  }

  .step-current {
    background-color: #01b8f5;
  }

  .step:nth-child(1) .arrow {
    border: none;
  }
}
</style>
